package events;

import wdmsim.Flow;
import wdmsim.Node;
import wdmsim.PhysicalTopology;
import wdmsim.Simulator;
import controlPlane.Handler;

public class OBGPDestroyLightpathEvent extends DestroyLightpath {

	Flow flow;
	PhysicalTopology pt = PhysicalTopology.getInstance();
	
	/**
	 * @param flow
	 * @throws Exception 
	 */
	public OBGPDestroyLightpathEvent(Flow flow) throws Exception {
		this.id = eventCounter++;
		this.generator = pt.getNode(flow.getSrc());
		this.handler = pt.getDomainFromNode(flow.getSrc()).getOBGPSPeaker();
		this.flow = flow;
	}

	public OBGPDestroyLightpathEvent(Flow flow, Node generator, Handler handler) {
		this.id = eventCounter++;
		this.generator = generator;
		this.handler = handler;
		this.flow = flow;
	}

	public Flow getFlow() {
		return flow;
	}
	
	public String toString() {
		return Simulator.CURRENT_TIME + " " + getId() + " " + getFlow().getId() + " " + ((Node) getHandler()).getId() + " " + getFlow().getSrc() + " " + getFlow().getDst() + " " + getFlow().getDuration();
	}
}
